package com.bosssoft.trainee.nontax.config;

import com.bosssoft.trainee.nontax.interceptor.SqlInjectFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

/**
 * @Description: 防止sql注入filter配置类
 * @Author: Luo WenLong
 * @Date: 2022/6/26 14:08
 */
// @Configuration
public class FilterConfiguration {
    @Bean("sqlFilter")
    public SqlInjectFilter sqlInjectFilter() {
        return new SqlInjectFilter();
    }
    @Bean
    public FilterRegistrationBean<SqlInjectFilter> sqlFilterRegistrationBean() {
        FilterRegistrationBean<SqlInjectFilter> filterReg = new FilterRegistrationBean<>();
        filterReg.setFilter(sqlInjectFilter());
        filterReg.addUrlPatterns("/*");
        filterReg.setOrder(1);
        return filterReg;
    }
}